home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #6 / Amiga Plus CD - 2004 - No. 06.iso / AmiSoft / Comm / misc / trsi-ftpd01.lha / FAME-FTPd / source / version.rexx < prev   
OS/2 REXX Batch file  |  2004-04-24  |  3KB  |  92 lines

  1. /*************************************************************
  2.  * version.rexx by Sascha 'SieGeL' Pfalz                     *
  3.  *                                                           *
  4.  * Updates and/or creates version.h file                     *
  5.  *                                                           *
  6.  * Supported Parameters:                                     *
  7.  *                                                           *
  8.  *  NONE     -> Update only Compile Date                     *
  9.  *  VERSION  -> Increment Version. Also sets Revision to 0   *
  10.  *  REVISION -> Increment Revision. Version won't be changed *
  11.  *                                                           *
  12.  * $VER: version.rexx 0.1 (05.05.2001)                       *
  13.  *                                                           *
  14.  * 0.2 (09.06.2003) - Added COMPILE_BUILD TAG                *
  15.  * 0.1 (05.05.2001) - Initial version                        *
  16.  *************************************************************/
  17.  
  18. verfile = 'version.h'
  19.  
  20. compiledate    = "#define COMPILE_DATE "
  21. compilever     = "#define COMPILE_VERSION "
  22. build          = "#define COMPILE_BUILD "
  23.  
  24. /********************************************
  25.  * Please do not modify anything else below *
  26.  ********************************************/
  27.  
  28. options results
  29.  
  30. compileversion = compilever
  31. mydate = DATE(S)
  32. myday  = SUBSTR(mydate,7,2)
  33. mymon  = SUBSTR(mydate,5,2)
  34. myyear = SUBSTR(mydate,1,4)
  35. currentdate = myday"."mymon"."myyear
  36. compiledate = compiledate||d2c(34)currentdate||d2c(34)
  37. IF WORD(ARG(1),1)='VERSION' THEN DO
  38.   updateversion  = 1
  39.   updaterevision = 0
  40. END
  41. ELSE IF WORD(ARG(1),1)='REVISION' THEN DO
  42.   updateversion  = 0
  43.   updaterevision = 1
  44. END
  45. ELSE DO
  46.   updateversion  = 0
  47.   updaterevision = 0
  48. END
  49. IF ~OPEN(fd,verfile,'r') THEN DO
  50.   compileversion = compileversion||d2c(34)||"0.1"||d2c(34)
  51.     newbuild = build||'1'
  52. END
  53. ELSE DO
  54.     READLN(fd)
  55.   compileversion = READLN(fd)
  56.     buildold = READLN(fd)
  57.     CLOSE(fd)
  58.   oldvertag = SUBSTR(compileversion,LENGTH(compilever)+2,LENGTH(compileversion)-LENGTH(compilever)-2)
  59.   oldver    = SUBSTR(oldvertag,1,INDEX(oldvertag,'.')-1)
  60.     oldrev    = SUBSTR(oldvertag,INDEX(oldvertag,'.')+1)
  61.     oldbuild  = SUBSTR(buildold,LENGTH(build))
  62.   IF updateversion = 1 THEN DO
  63.         ver = oldver + 1
  64.     rev = 0
  65.   END
  66.   ELSE IF updaterevision = 1 THEN DO
  67.     ver = oldver
  68.     rev = oldrev + 1
  69.         IF rev >=999 THEN DO
  70.       rev = 0
  71.       ver = ver + 1
  72.         END
  73.   END
  74.     ELSE DO
  75.         ver = oldver
  76.     rev = oldrev
  77.   END
  78.   compileversion = compilever||d2c(34)||ver||"."||rev||d2c(34)
  79.     oldbuild = oldbuild + 1
  80.     newbuild = build||oldbuild
  81. END
  82. IF ~OPEN(fd,verfile,'w') THEN DO
  83.   SAY "Cannot open "verfile" for writing!!!"
  84.   EXIT
  85. END
  86. ELSE
  87.   WRITELN(fd,compiledate)
  88.   WRITELN(fd,compileversion)
  89.     WRITELN(fd,newbuild)
  90.   CLOSE(fd)
  91. EXIT
  92.